package com.gwg.controller;

import com.fly.common.model.OrderEntity;
import com.gwg.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description 测试
 * @author: liying.fu
 * @Date: 2018/11/25 下午12:43
 */
@RestController
@RequestMapping("/demoController")
public class DemoController {

    @Autowired
    private DemoService demoService;

    @RequestMapping(path = "/demoMethod", method = RequestMethod.POST)
    public String demo(OrderEntity orderEntity) {
        demoService.save(orderEntity);
        return "SUCCESS";
    }
    @RequestMapping(path = "/demoMethodDel", method = RequestMethod.POST)
    public String delete(Long orderId){
        System.out.println(orderId);
        demoService.delete(orderId);
        return "TRUE";
    }
    @RequestMapping(path = "/demoMethodsel",method = RequestMethod.POST)
    public OrderEntity select(Long orderId){
       return demoService.select(orderId);
    }
    @RequestMapping(path = "/demoMethodup",method = RequestMethod.POST)
    public int update(OrderEntity orderEntity){
        demoService.update(orderEntity);
        return 1;
    }

}
